Skip to main content

Spacing

Kyber's spacing utilities are based on relative pixel values from 8px. These are exposed as CSS custom properities and used to generate the utility classes. The numeric value in the variable name corresponds to the utility class margin and padding numeric values. The following table shows the custom properties and their corresponding values.

VariableValueEquivalent pixels
--k-spacer-000px
--k-spacer-0-5base * 0.54px
--k-spacer-1base8px
--k-spacer-1-5base * 1.512px
--k-spacer-2base * 216px
--k-spacer-2-5base * 2.520px
--k-spacer-3base * 324px
--k-spacer-4base * 432px
--k-spacer-5base * 540px
--k-spacer-6base * 648px
--k-spacer-8base * 864px
--k-spacer-10base * 1080px

Margin and padding

Utility classes are provided to apply margin and padding to elements. The classes are named using the format k-{property}{sides}-{size} for xs and k-{property}{sides}-{breakpoint}-{size} for sm, md, lg, xl, and xxl breakpoints.

Where property is one of:

m - for classes that set margin

p - for classes that set padding

Where sides is one of:

t - for classes that set margin-top or padding-top

b - for classes that set margin-bottom or padding-bottom

s - (start) for classes that set margin-left or padding-left in LTR, margin-right or padding-right in RTL

e - (end) for classes that set margin-right or padding-right in LTR, margin-left or padding-left in RTL

x - for classes that set both _-left and _-right

y - for classes that set both _-top and _-bottom

blank - for classes that set a margin or padding on all 4 sides of the element

Where size is one of:

SizeValueEquivalent pixels
000px
0-5base * 0.54px
1base8px
1-5base * 1.512px
2base * 216px
2-5base * 2.520px
3base * 324px
4base * 432px
5base * 540px
6base * 648px
8base * 864px
10base * 1080px
autoauto

Negative spacing

Utility classes for negative margin (not padding) and variables for negative spacing are available for special cases where negative spacing is needed for alignment. The variables and classes are the same as above but with the addition of n before the size (e.g., var(--k-spacer-n2) for -16px or .k-mx-n1 for -8px of left margin).